<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'estate.label', default: 'estate')}"/>
    <title>分析报告</title>
    <style>
    .table>tbody>tr>td{
        vertical-align: middle;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar">
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>分析报告</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                %{--<a href="index" class="pe-7s-back fa-2x">&nbsp;&nbsp;</a>--}%
                分析报告
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">

    <div class="row">
        <g:form method="POST" action="report1" class="form-horizontal" role="form">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    查询
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" id="searchData" type="submit"><i class="fa fa-search"></i> 查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn"><i class="fa fa-times"></i> 重置</button>
                    </div>
                </div>

                <div class="panel-body seach-group" id="bug1">
                    <div class="row">
                        <div class="form-group col-sm-3">
                            <label for="city" class="col-sm-4 control-label">城市</label>
                            <div class="col-sm-8">
                                <g:select class="form-control" name="city" id="city" from="${com.cindata.City.executeQuery("select distinct e.city as city from  Estate e where e.city.id <> 1660")}" valueMessagePrefix="status" optionKey="zoneNumber" optionValue="name" value="${params?.city}" noSelection="${['': '请选择城市']}"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </g:form>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    %{--<button class="btn  btn-warning2 btn-xs " type="button" id="toPrint"><i class="fa fa-print"></i> 打印报告</button>--}%
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>

                </div>
                贷款人分析
            </div>
            <div class="panel-body" style="border-bottom: none; padding-bottom: 0">
                <div>
                    <h4 style="font-size: 13px;">城市/行政区贷款人分布</h4>
                    <g:if test="${estateCounts != 0}">
                        <span><strong>${this.accountName}</strong> 贷款分布在 <strong style="color: #FF0000;">${districtCounts}</strong> 个行政区，共 <strong style="color: #FF0000;">${estateCounts}</strong> 笔贷款，其中在 <strong style="color: #62cb31;">${districtName1}</strong> 的数量最多，有 <strong style="color: #FF0000;">${districtEstateCounts1}</strong> 笔，占全量贷款笔数的 <strong style="color: #FF0000;"><g:formatNumber number="${districtEstateCounts1/estateCounts*100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong>，其次为 <strong style="color: #62cb31;">${districtName2}</strong> 和 <strong style="color: #62cb31;">${districtName3}</strong>，贷款数量分别为 <strong style="color: #FF0000;">${districtEstateCounts2}</strong> 笔和 <strong style="color: #FF0000;">${districtEstateCounts3}</strong> 笔，分别占全量贷款笔数的 <strong style="color: #FF0000;"><g:formatNumber number="${districtEstateCounts2/estateCounts*100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong> 和 <strong style="color: #FF0000;"><g:formatNumber number="${districtEstateCounts3/estateCounts*100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong></span>
                    </g:if>
                    <g:else>
                        <span><strong>${this.accountName}</strong> 贷款分布在 <strong  style="color: #FF0000;">${districtCounts}</strong> 个行政区，共 <strong style="color: #FF0000;">${estateCounts}</strong> 笔贷款，其中在 <strong style="color: #62cb31;">${districtName1}</strong> 的数量最多，有 <strong style="color: #FF0000;">${districtEstateCounts1}</strong> 笔，占全量贷款笔数的 <strong  style="color: #FF0000;">0.00%</strong>，其次为 <strong style="color: #62cb31;">${districtName2}</strong> 和 <strong style="color: #62cb31;">${districtName3}</strong>，贷款数量数量分别为 <strong style="color: #FF0000;">${districtEstateCounts2}</strong> 笔和 <strong style="color: #FF0000;">${districtEstateCounts3}</strong> 笔，分别占全量贷款笔数的 <strong style="color: #FF0000;">0.00%</strong> 和 <strong style="color: #FF0000;">0.00%</strong></span>
                    </g:else>
                </div>

            </div>

            <div class="row">
                <div class="hpanel" style="">

                    <div class="col-md-12">
                        <div class="hpanel">

                        </div>

                    </div>
                </div>
            </div>
        </div>

    </div>
    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                贷款分析
            </div>
            <div class="panel-body">
                <div>
                    <h4 style="font-size: 13px;">贷款人贷款期分布</h4>
                    <span><strong>${accountName}</strong> 全量贷款笔数贷款期分布主要集中在 <strong style="color: #FF0000;"><span id="y1">年、</span></strong><strong style="color: #FF0000;"><span id="y2">年、</span></strong> <strong style="color: #FF0000;"><span id="y3">年、</span></strong>各年份放款数量如下：</span>
                    <div id="estateStart" style="width: 100%;height: 420px;"></div>
                </div>
                <hr/>
                <div>
                    <h4 style="font-size: 13px;">贷款剩余还款期分布</h4>
                    <g:if test="${estateCounts != 0}">
                        <span><strong>${accountName}</strong> 按剩余还款期限统计贷款数量，剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[0].remainTime}</strong> 的贷款数据最多，包括 <strong style="color: #FF0000;">${remainTimeList[0].counts}</strong> 笔贷款，占总量贷款的 <strong style="color: #FF0000;"><g:formatNumber number="${remainTimeList[0].counts/estateCounts * 100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong>；其次是剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[1].remainTime}</strong> 年的贷款，包括 <strong style="color: #FF0000;">${remainTimeList[1].counts}</strong> 笔贷款，占总量贷款的<strong style="color: #FF0000;"><g:formatNumber number="${remainTimeList[1].counts/estateCounts * 100}" minFractionDigits="2" maxFractionDigits="2"/>%</strong>。</span>
                    </g:if>
                    <g:else>
                        <span><strong>${accountName}</strong> 按剩余还款期限统计贷款数量，剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[0].remainTime}</strong> 的贷款数据最多，包括 <strong style="color: #FF0000;">${remainTimeList[0].counts}</strong> 笔贷款，占总量贷款的 <strong style="color: #FF0000;">0.00%</strong>；其次是剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[1].remainTime}</strong> 年的贷款，包括 <strong style="color: #FF0000;">${remainTimeList[1].counts}</strong> 笔贷款，占总量贷款的<strong style="color: #FF0000;">0.00%</strong>。</span>
                    </g:else>
                    <div class="table-responsive">
                        <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="">
                            <thead>
                            <tr>
                                <g:sortableColumn property="city" title="剩余还款期" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="district" title="贷款数量" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="counts" title="占比" class=" col-md-1 text-center" params="${params}"/>
                            </tr>
                            </thead>
                            <tbody>
                            <g:each in="${remainTimeList}">
                                <tr>
                                    <td class="text-center">${it?.remaintime}</td>
                                <td class="text-center">${it?.counts}</td>
                                <td class="text-center"><g:if test="${estateCounts != 0}"><g:formatNumber number="${it?.counts/estateCounts * 100}" minFractionDigits="2" maxFractionDigits="2"/></g:if><g:else>0.00</g:else>%</td>
                                </td>
                            </tr>
                            </g:each>
                            </tbody>
                        </table>
                    </div>
                </div>
                <hr/>
                <div>
                    <h4 style="font-size: 13px;">逾期贷款情况预警</h4>
                    <span><strong>${accountName}</strong> 有 <strong style="color: #FF0000;">${overdueCounts}</strong> 笔贷款，超过还款期限，仍未偿还完，针对这部分贷款，银行应该特别重视，以下是逾期贷款分布情况：</span>
                    <div class="table-responsive">
                        <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" >
                            <thead>
                            <tr>
                                <g:sortableColumn property="city" title="小区名称" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="district" title="逾期贷款数量" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="counts" title="受理网点" class=" col-md-1 text-center" params="${params}"/>
                            </tr>
                            </thead>
                            <tbody>
                            <g:each in="${overdueList}">
                                <tr>
                                    <td class="text-center">${it?.communityName}</td>
                                <td class="text-center">${it?.overnumbers}</td>
                                <td class="text-center">${it?.accountName}</td>
                                </td>
                            </tr>
                            </g:each>
                            </tbody>
                        </table>
                    </div>
                </div>
                <hr/>
            </div>
        </div>
    </div>


</div>


<g:javascript>
    
    $("#s2id_city span:first").html('${cityName}');
    $("#city").val('${zoneNumber}');

    //重置按钮
    $("#resetBtn").click(function () {
        $("#s2id_city span:first").html("请选择城市");
        $("#city").val("");
    })
</g:javascript>

<asset:javascript src="echarts/echarts-all-3.js" />
<asset:javascript src="main/report1.js" />
</body>
</html>
